/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.star.common;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author ngotandieu
 */
public class UserData {

    String id;
    String username;
    String passwdMD5;
    String groupname;
    String access;
    long created;

    // contructor for add new
    public UserData(String username, String pass, String groupName, String access) {
        this.username = username.toLowerCase();
        this.passwdMD5 = CommonUtil.md5(pass);
        this.groupname = groupName;
        this.access = access;
        this.created = System.currentTimeMillis();
    }
    
    // contructor for edit
    public UserData(String id, String username, String pass, String groupName, String access) {
        this.id = id;        
        this.username = username.toLowerCase();
        this.passwdMD5 = pass;
        this.groupname = groupName;
        this.access = access;
    }
    
    public UserData(String id, String username, String passwdMD5, String groupName, String access, long created) {
        this.id = id;
        this.username = username.toLowerCase();
        this.passwdMD5 = passwdMD5;
        this.groupname = groupName;
        this.access = access;
        this.created = created;
    }

    public String getId() {
        return id;
    }

    public String getUsername() {
        return username;
    }

    public String getPasswdMD5() {
        return passwdMD5;
    }

    
    public long getCreated() {
        return created;
    }
    
    public void setId(String id) {
        this.id = id;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public void setPasswdMD5(String passwdMD5) {
        this.passwdMD5 = passwdMD5;
    }

    public void setCreated(long created) {
        this.created = created;
    }

    public String getGroupname() {
        return groupname != null ? groupname : "";
    }

    public void setGroupname(String groupname) {
        this.groupname = groupname;
    }

    public String getAccess() {
        return access != null ? access : "";
    }

    public void setAccess(String access) {
        this.access = access;
    }
    
    
}
